package com.angel.service.ServiceImpl;

import com.angel.bean.CmsInfo;
import com.angel.mapper.CmsInfoDao;
import com.angel.service.CmsInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CmsInfoServiceImpl implements CmsInfoService{

    @Resource
    private CmsInfoDao cmsInfoDao;

    @Override
    public int insert(CmsInfo cmsInfo){
        return cmsInfoDao.insert(cmsInfo);
    }

    @Override
    public int insertSelective(CmsInfo cmsInfo){
        return cmsInfoDao.insertSelective(cmsInfo);
    }

    @Override
    public int insertList(List<CmsInfo> cmsInfos){
        return cmsInfoDao.insertList(cmsInfos);
    }

    @Override
    public int update(CmsInfo cmsInfo){
        return cmsInfoDao.update(cmsInfo);
    }

    @Override
    public List<CmsInfo> findAll(CmsInfo cmsInfo) { return cmsInfoDao.findAll(cmsInfo);}

    @Override
    public CmsInfo findOne(CmsInfo cmsInfo){

            List<CmsInfo> list = this.findAll(cmsInfo);
            if(list == null || list.isEmpty() ){
                    return null;
            }
            return list.get(0);
    }

    @Override
    public List<CmsInfo> findAllStart(CmsInfo cmsInfo) {
        return cmsInfoDao.findAllStart(cmsInfo);
    }

    @Override
    public List<CmsInfo> findFiveAll(CmsInfo cmsInfo) {
        return cmsInfoDao.findFiveAll(cmsInfo);
    }
}
